<?php
    $con=mysql_connect("sql307.freevnn.com",'freev_11941239','khoaluan')or die(mysql_error());
    mysql_select_db("freev_11941239_kfc",$con) or die(mysql_error());	
    mysql_query("SET NAMES 'utf8'",$con);
	mysql_set_charset('utf8',$con);
    
    $username = $_POST['username'];
    $password = md5($_POST['password']);
      
    $respone = array();
    
    $sql = "SELECT * FROM user WHERE username='$username' and password='$password'";
    $query = mysql_query($sql);
    $num = mysql_num_rows($query);
    if($num == 1)
    {
        $respone["success"] = 1;
        
    }
    else
    {
        $respone["success"] = 0;
    }
    $sql1="SELECT * FROM number_of_table";
    $query1=mysql_query($sql1);
    $data=mysql_fetch_assoc($query1);
    $respone["number_table"]=$data["table_number"];
    
    echo json_encode($respone);
?>